﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HexPixel.CustomControl
{
	class HexEditBox : System.Windows.Forms.TextBox
	{
		private short m_inputCount = 0;

		public HexEditBox()
		{
		}

		protected override void OnKeyDown(KeyEventArgs e)
		{
			base.OnKeyDown(e);

			if (Keys.D0 <= e.KeyCode && e.KeyCode <= Keys.Z)
			{
				if (Keys.D0 <= e.KeyCode && e.KeyCode <= Keys.F)
				{
					if (Keys.Alt == e.KeyData)
					{
						MessageBox.Show("");
						return;
					}

					if (this.Text.Length == 0)
					{
						return;
					}

					m_inputCount++;

					if (m_inputCount == 2)
					{
						this.Text += " ";
						m_inputCount = 0;
					}

					// 커서 이동
					this.SelectionStart = this.Text.Length;
					this.ScrollToCaret();
				}
				else
				{
					e.Handled = true;
				}
			}
			else
			{
				if (e.KeyData == (Keys.Control | Keys.V))
				{
					
				}
			}
		}
	}
}